import configUrls from "../urls/interAction";
import { get, post } from "../axios";
import axios, { AxiosResponse, } from "axios";
export default {
  //评论管理
  //添加评论
  fetchCommentAddComment(data: object) {
    return post(configUrls.commentAddComment, data);
  },
  //评论点赞
  fetchCommentAddLikeCnt(data: object) {
    return post(configUrls.commentAddLikeCnt, data);
  },
  //管理员回复
  fetchCommentAdminReply(data: object) {
    return post(configUrls.commentAdminReply, data);
  },
  //审核不通过
  fetchCommentAuditFailed(data: object) {
    return post(configUrls.commentAuditFailed, data);
  },
  //审核通过
  fetchCommentAuditPass(data: object) {
    return post(configUrls.commentAuditPass, data);
  },
  //取消举报
  fetchCommentCancelReport(data: object) {
    return post(configUrls.commentCancelReport, data);
  },
  //解除ip禁言
  commentCancelSilencedCommentIp(data: object) {
    return post(configUrls.commentCancelSilencedCommentIp, data);
  },
  //解除评论者禁言
  commentCancelSilencedCommentator(data: object) {
    return post(configUrls.commentCancelSilencedCommentator, data);
  },
  //获取评论举报
  fetchCommentCommentReports(data: object) {
    return get(configUrls.commentCommentReports, data);
  },
  //删除评论
  fetchCommentDelete(data: object) {
    return post(configUrls.commentDelete, data);
  },
  //当前站点是否需要审核评论
  fetchCommentIsNeedAudit(data: object) {
    return get(configUrls.commentIsNeedAudit, data);
  },
  //评论分页
  fetchCommentPage(data: object) {
    return get(configUrls.commentPage, data);
  },
  //举报评论分页
  fetchCommentReportPage(data: object) {
    return get(configUrls.commentReportPage, data);
  },
  //评论举报
  fetchCommentReportComment(data: object) {
    return post(configUrls.commentReportComment, data);
  },
  //禁言评论ip
  fetchCommentSilencedCommentIp(data: object) {
    return post(configUrls.commentSilencedCommentIp, data);
  },
  //禁言评论者
  fetchCommentSilencedCommentator(data: object) {
    return post(configUrls.commentSilencedCommentator, data);
  },
  //管理员更新回复
  fetchCommentUpdateAdminReply(data: object) {
    return post(configUrls.commentUpdateAdminReply, data);
  },
  //用户禁言分页
  fetchSilencedUserPage(data: object) {
    return get(configUrls.silencedUserPage, data);
  },
  //用户取消禁言
  fetchSilencedUserCancelSilencedUser(data: object) {
    return post(configUrls.silencedUserCancelSilencedUser, data);
  },
  //IP禁言分页
  fetchSilencedIpPage(data: object) {
    return get(configUrls.silencedIpPage, data);
  },
  //IP取消禁言
  fetchSilencedIpCancelSilencedIp(data: object) {
    return post(configUrls.silencedIpCancelSilencedIp, data);
  },
  //被举报的数目
  fetchCommentReportedCnt(data: object) {
    return get(configUrls.commentReportedCnt, data);
  },

  // 采集管理
  // 获取APPID
    fetchCollectGetId(data: any) {
      return get(configUrls.collectGetId, data)
  },
  // 手动移库
  fetchCollectConsumeByIds(data: any) {
      return post(configUrls.collectConsumeByIds, { 'ids': data.ids, 'taskId': data.taskId, 'identity': data.identity })
  },
  // 数据迁移
  fetchCollectConsume(data: any) {
      return axios.get(configUrls.collectConsume + `?taskId=${data.taskId}&appId=${data.appId}&identity=${data.identity}`)
  },
  // 采集任务详情
  setCollectId () {
    return axios.put(configUrls.collectId)
  },
  // 检查任务数量限制
  fetchAddCollectEnable (data: any) {
    return axios.get(configUrls.fetchAddCollectEnable + `?appId=${data.appId}&identity=${data.identity}&siteId=${data.siteId}`)
  },
  // 采集获取APPID和模型
  fetchSetYunAppIdOrModel (data: object) {
    return axios.put(configUrls.yunAppIdOrModel, data)
  },
  // 采集任务详情
  fetchCollectTaskDetail (data: any) {
    return axios.get(configUrls.collectTask + `/${data.id}`)
  },
  // 采集任务列表
  fetchCollectTaskList (data: any) {
    return axios.get(configUrls.collectTask + `?appId=${data.id}&identity=${data.identity}&siteId=${data.siteId
    }&size=1000`)
  },
  // 采集模板详情
  fetchCollectTemplate (data: any) {
    return axios.get(configUrls.collectTask + `/${data.id}?appId=${data.appId}&identity=${data.identity}`)
  },
  // 删除采集任务
  deleteCollectTask (data: any) {
    return axios.delete(configUrls.collectTask + `/${data.id}?appId=${data.appId}&identity=${data.identity}`)
  },
  // 采集数据列表分页
  fetchCollectContentPage (data: any) {
    data.page = data.page || 1
    data.size = data.size || 10
    return axios.get(configUrls.collectContentList + `?taskId=${data.id}&appId=${data.appId}&identity=${data.identity}&page=${data.page}&size=${data.size}`)
  },
  // 删除采集内容
  fetchCollectContent (data: any) {
    return axios.delete(configUrls.collectContentList + `?appId=${data.appId}&identity=${data.identity}`, {data: data.data})
  },
  // 清空所有数据
  fetchCollectContentAll (data: any) {
    return axios.delete(configUrls.collectContentList + `/clear?id=${data.id}&appId=${data.appId}&identity=${data.identity}`, {})
  },
  // 采集任务开始采集
  fetchCollectTasksStart (data: any) {
    return axios.get(configUrls.collectTasksStart + `/${data.id}?appId=${data.appId}&identity=${data.identity}`, {})
  },
  // 采集插件信息
  fetchCollectPlugin (data: any) {
    return axios.get(configUrls.collectPlugin, data)
  },
  // 检测应用是否授权
  fetchApplyAuthorizations (data: any) {
    return axios.get(configUrls.authorizations, data)
  }
};
